Skip to content

ITEP-89462 Refactor and add UT for controller analytics functions#1299

Open
tdorauintc wants to merge 12 commits intomainfrom
refactor/controller-analytics-functions
Open

ITEP-89462 Refactor and add UT for controller analytics functions#1299
tdorauintc wants to merge 12 commits intomainfrom
refactor/controller-analytics-functions

Conversation

@tdorauintc
Copy link
Copy Markdown
Contributor

@tdorauintc tdorauintc commented Apr 10, 2026

📝 Description

Changes:

  • Refactoring of tripwire and region events calculation into an isolated, easily testable primitive functions (independent from controller) operating in batched manner, that can be further optimized and unit tested.
  • Adding comprehensive unit tests of the new functions.

Background:

  • Short-term goal is to enable unit testing of the functionality in SceneScape and early reuse in DLStreamer PoC of gvaAnalytics element.
  • Long-term goal is to establish a common interface that encapsulates the functionality and enables future optimizations (batch processing, C++ implementation) and reuse.

✨ Type of Change

Select the type of change your PR introduces:

  • 🐞 Bug fix – Non-breaking change which fixes an issue
  • 🚀 New feature – Non-breaking change which adds functionality
  • 🔨 Refactor – Non-breaking change which refactors the code base
  • 💥 Breaking change – Changes that break existing functionality
  • 📚 Documentation update
  • 🔒 Security update
  • 🧪 Tests
  • 🚂 CI

🧪 Testing Scenarios

Validated with the following automated tests: mqtt-tripwire, mqtt-roi, geometry-unit

  • ✅ Tested manually
  • 🤖 Ran automated end-to-end tests

✅ Checklist

Before submitting the PR, ensure the following:

  • 🔍 PR title is clear and descriptive
  • 📝 For internal contributors: If applicable, include the JIRA ticket number (e.g., ITEP-123456) in the PR title. Do not include full URLs
  • 💬 I have commented my code, especially in hard-to-understand areas
  • 📄 I have made corresponding changes to the documentation
  • ✅ I have added tests that prove my fix is effective or my feature works

@tdorauintc tdorauintc changed the title Refactor controller analytics functions ITEP-89464 Refactor controller analytics functions Apr 10, 2026
@tdorauintc tdorauintc changed the title ITEP-89464 Refactor controller analytics functions ITEP-89464 Refactor controller analytics functions and add UT Apr 13, 2026
@tdorauintc tdorauintc changed the title ITEP-89464 Refactor controller analytics functions and add UT ITEP-89464 Refactor and add UT for controller analytics functions Apr 13, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors controller analytics for tripwire/region event detection into reusable, batch-oriented helpers in scene_common.geometry, and adds unit tests to validate the new primitives independently of the controller.

Changes:

  • Added get_tripwire_events() and get_region_events() helpers to scene_common.geometry.
  • Updated controller.scene.Scene to use the new helpers for analytics event calculation.
  • Added new geometry unit tests covering tripwire crossings and region containment.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
scene_common/src/scene_common/geometry.py Introduces batched helper functions to compute tripwire crossings and region membership.
controller/src/controller/scene.py Refactors tripwire/region event update logic to call the new geometry helpers.
tests/sscape_tests/geometry/test_tripwire_events.py Adds unit tests for tripwire crossing detection across orientations and edge cases.
tests/sscape_tests/geometry/test_region_events.py Adds unit tests for region containment across polygon/circle/scene region types.

Comment thread tests/sscape_tests/geometry/test_tripwire_events.py
Comment thread controller/src/controller/scene.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@tdorauintc tdorauintc marked this pull request as ready for review April 13, 2026 14:20
@tdorauintc tdorauintc changed the title ITEP-89464 Refactor and add UT for controller analytics functions ITEP-89462 Refactor and add UT for controller analytics functions Apr 13, 2026
Copy link
Copy Markdown
Contributor

@ltalarcz ltalarcz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants